import type { ResponsePaginationData } from '@/utils/request';
import type { BlackListItem, TableListItem } from './data';
import type { RequestData } from '@ant-design/pro-table';
import { request } from 'umi';

type Pagination = { page?: number; pageSize?: number };

export async function queryCreditBlackList(params: Pagination & { plateNumber?: string }): Promise<RequestData<TableListItem>> {
  const { page = 1, pageSize = 10, plateNumber } = params;
  const res: ResponsePaginationData<BlackListItem> = await request('/credit/blacklist/list', {
    params: { page, pageSize, plateNumber },
  });
  return {
    success: true,
    data: res.data.list,
    total: res.data.total,
  };
}


export async function removeCreditBlackList(params: { id: string }): Promise<{ success: boolean }> {
  return request('/credit/blacklist/remove', {
    method: 'POST',
    params,
  });
}